package com.wimcorp.magic.abilities.trigger;

import javax.persistence.Entity;

import com.wimcorp.magic.abilities.Ability;
import com.wimcorp.magic.abilities.ComboAbility;
import com.wimcorp.magic.abilities.ConditionAbility;

@Entity
public class ConditionTrigger extends AbilityTrigger {

	public ConditionTrigger() {
	}

	public ConditionTrigger(Ability ability) {
		super(ability);
	}

	public ConditionTrigger(ConditionTrigger abilityTrigger) {
		super(abilityTrigger);
	}

	@Override
	public void register() {
		/*ConditionAbility conditionAbility = (ConditionAbility) getAbility();
		Ability conditionAbility2 = conditionAbility.getConditionAbility();
		if (conditionAbility2 != null) {
			AbilityTrigger trigger = conditionAbility2.getTrigger();
			trigger.getAbility().setCard(conditionAbility.getCard());
			trigger.register();
		}
		Ability nonConditionAbility = conditionAbility.getNonConditionAbility();
		if (nonConditionAbility != null) {
			AbilityTrigger trigger = nonConditionAbility.getTrigger();
			trigger.getAbility().setCard(conditionAbility.getCard());
			trigger.register();
		}*/
		ConditionAbility conditionAbility = (ConditionAbility) getAbility();
		conditionAbility.register();
		//getAbility().getPlayer().cast(getAbility());
	}

	public void unRegister() {
		/*ConditionAbility conditionAbility = (ConditionAbility) getAbility();
		Ability conditionAbility2 = conditionAbility.getConditionAbility();
		if (conditionAbility2 != null) {
			conditionAbility2.getTrigger().unRegister();
		}
		Ability nonConditionAbility = conditionAbility.getNonConditionAbility();
		if (nonConditionAbility != null) {
			nonConditionAbility.getTrigger().unRegister();
		}*/
		ConditionAbility conditionAbility = (ConditionAbility) getAbility();
		conditionAbility.unRegister();
	}

	public ConditionTrigger clone() {
		return new ConditionTrigger(this);
	}

}
